import Vue from 'vue';
import router from './router';
import App from './views/App.vue';

import '@/assets/css/com-reset.css';
import '@/assets/css/com-style.css';
import '@/assets/css/com-theme.css';

import $ApiUtil from '@/utils/ApiUtil';
import $HttpUtil from '@/utils/HttpUtil';
import $HttpCodeUtil from '@/utils/HttpCodeUtil';
Vue.prototype.$ApiUtil = $ApiUtil;
Vue.prototype.$HttpUtil = $HttpUtil;
Vue.prototype.$HttpCodeUtil = $HttpCodeUtil;

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
ElementUI.Tree.props.indent.default = 18;
ElementUI.Dialog.props.showClose.default = false;
ElementUI.Dialog.props.closeOnClickModal.default = false;
ElementUI.Dialog.props.closeOnPressEscape.default = false;
// 禁止点击遮罩层关闭抽屉层
ElementUI.Drawer.props.wrapperClosable = false;
// 禁止点按ESC键关闭抽屉层
ElementUI.Drawer.props.closeOnPressEscape = false;
Vue.use(ElementUI);

Vue.config.productionTip = false;
router.beforeEach((to, from, next) => {
    if (to.matched.some(record => record.meta.authc)) {
        // if (!window.localStorage.token) {
        //     next({
        //         path: "/login",
        //         query: {
        //             msg: "当前登录已过期，请重新登录",
        //             redirect: to.fullPath
        //         }
        //     });
        //     return;
        // }
    }
    next();
});
new Vue({
    el: '#app',
    router,
    components: { App },
    template: '<App/>',
});
